package com.jizhi.onework.utils;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;

/**
 * 生成随机盐工具类
 *
 * @author hzhang7
 */
public class SaltUtil {

    /**
     * 生成随机盐
     */
    public static String randomSalt() {
        // 一个Byte占两个字节，此处生成的3字节，字符串长度为6
        SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
        String hex = secureRandom.nextBytes(3).toHex();
        return hex;
    }
}
